/*
* MiddleResultServiceImpl.java
* Created on  2015/6/7 21:53
* 版本       修改时间          作者      修改内容
* V1.0.1    2015/6/7       xfz    初始版本
*
*/

package com.infitecs.eyas.result.service.impl;

import com.infitecs.eyas.boiler.dao.AirGasParameterDao;
import com.infitecs.eyas.boiler.dao.EfficiencyDao;
import com.infitecs.eyas.boiler.dao.SodaParameterDao;
import com.infitecs.eyas.boiler.model.AirGasParameter;
import com.infitecs.eyas.boiler.model.Efficiency;
import com.infitecs.eyas.boiler.model.SodaParameter;
import com.infitecs.eyas.expression.dao.ExpressionDao;
import com.infitecs.eyas.expression.model.Formula;
import com.infitecs.eyas.nature.dao.NatureDao;
import com.infitecs.eyas.nature.model.Nature;
import com.infitecs.eyas.quality.dao.ElementDao;
import com.infitecs.eyas.quality.dao.IndustryDao;
import com.infitecs.eyas.quality.model.Element;
import com.infitecs.eyas.quality.model.Industry;
import com.infitecs.eyas.result.dao.MiddleResultDao;
import com.infitecs.eyas.result.model.MiddleResult;
import com.infitecs.eyas.result.service.MiddleResultService;
import com.infitecs.eyas.util.DoubleUtil;
import com.infitecs.eyas.util.Parameter;
import com.infitecs.eyas.util.ParametersUtil;
import fr.expression4j.core.Expression;
import fr.expression4j.core.Parameters;
import fr.expression4j.core.exception.EvalException;
import fr.expression4j.core.exception.ParsingException;
import fr.expression4j.factory.ExpressionFactory;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.stereotype.Service;

import java.util.HashSet;
import java.util.Set;

/**
 * 类的描述信息
 *
 * @author xfz
 * @version 1.0.1
 */
@Service("MiddleResultService")
public class MiddleResultServiceImpl implements MiddleResultService {
    @Autowired
    MiddleResultDao middleResultDao;
    @Autowired
    ElementDao elementDao;
    @Autowired
    IndustryDao industryDao;
    @Autowired
    private ExpressionDao expressionDao;
    @Autowired
    private AirGasParameterDao airGasParameterDao;
    @Autowired
    private SodaParameterDao sodaParameterDao;
    @Autowired
    private NatureDao natureDao;
    @Autowired
    private EfficiencyDao efficiencyDao;

    /*公式8*/
    @Override
    public Double calculateE47(int caseId, int powerId) {
        Element element = elementDao.getElementByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式8");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("ME17", element.getQgrAr()));
        params.add(new Parameter("ME30", element.getSar()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E47", result));
        return result;
    }

    /*判断公式9*/
    @Override
    public Double calculateE48(int caseId, int powerId) {
        double e47 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E47"));
        Double result = null;
        if (e47 < 1.5)
            result = 68.3;
        if (e47 >= 1.5 && e47 <= 3.5)
            result = 8.265 * e47 + 56;
        else
            result = 85.00;
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E48", result));
        return result;
    }

    /*公式10*/
    @Override
    public Double calculateE49(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式10");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e48 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E48"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E31", air.getInOnceWindTemperature()));
        params.add(new Parameter("E32", air.getInTwiceWindTemperature()));
        params.add(new Parameter("E42", air.getOnceWindRate()));
        params.add(new Parameter("E48", e48));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E49", result));
        return result;
    }

    /*公式89*/
    @Override
    public Double calculateE51(int caseId) {
        Industry industry = industryDao.getIndustryByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式89");
        Double me10 = industry.getVdaf();
        Double result = null;
        if (me10 > 30)
            result = 2.00;
        else {
            String exp = formula.getParamer() + formula.getFormulaDescription();
            Expression expression = null;
            try {
                expression = ExpressionFactory.createExpression(exp);
            } catch (ParsingException e) {
                e.printStackTrace();
            }
            Set<Parameter> params = new HashSet<>();
            params.add(new Parameter("ME10", me10));
            Parameters parameters = ParametersUtil.getParameters(params);

            try {
                result = expression.evaluate(parameters).getRealValue();
            } catch (EvalException e) {
                e.printStackTrace();
            }
        }
        return result;
    }

    /*公式11*/
    @Override
    public Double calculateE52(int caseId, int powerId) {
        Element element = elementDao.getElementByPowerCaseId(caseId);
        Industry industry = industryDao.getIndustryByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式11");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e51 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E51"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("ME6", industry.getAar()));
        params.add(new Parameter("E51", e51));
        params.add(new Parameter("ME13", element.getQnetAr()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E52", result));
        return result;
    }

    /*判断公式12*/
    @Override
    public Double calculateE53(int caseId, int powerId) {
        Element element = elementDao.getElementByPowerCaseId(caseId);
        Industry industry = industryDao.getIndustryByPowerCaseId(caseId);
        Double result = null;
        Double me6 = industry.getAar();
        Double me13 = element.getQnetAr();
        result = ((me13 / 420) > me6) ? 0 : (100 / me13);
        double E53 = DoubleUtil.getInstance().get2Double(result);
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E53", E53));
        return result;
    }

    /*公式13*/
    /*以公式元素为准*/
    @Override
    public Double calculateE55(int caseId, int powerId) {
        Element element = elementDao.getElementByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式13");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("ME26", element.getCar()));
        params.add(new Parameter("ME27", element.getHar()));
        params.add(new Parameter("ME30", element.getSar()));
        params.add(new Parameter("ME28", element.getOar()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E55", result));
        return result;
    }

    /*公式14*/
    /*以公式元素为准*/
    @Override
    public Double calculateE56(int caseId, int powerId) {
        Element element = elementDao.getElementByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式14");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("ME26", element.getCar()));
        params.add(new Parameter("ME27", element.getHar()));
        params.add(new Parameter("ME30", element.getSar()));
        params.add(new Parameter("ME28", element.getOar()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E56", result));
        return result;
    }

    /*公式15*/
    @Override
    public Double calculateE57(int caseId, int powerId) {
        Nature nature = natureDao.getNatureByPowerId(powerId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式15");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e55 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E55"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E55", e55));
        params.add(new Parameter("ZE14", nature.getAnnualAverageAirMoisture()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E57", result));
        return result;
    }

    /*公式16*/
    @Override
    public Double calculateE58(int caseId, int powerId) {
        Nature nature = natureDao.getNatureByPowerId(powerId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式16");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e57 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E57"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E57", e57));
        params.add(new Parameter("ZE15", nature.getLocalDensityMoistAir()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E58", result));
        return result;
    }

    /*公式17*/
    @Override
    public Double calculateE59(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式17");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e58 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E58"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E58", e58));
        params.add(new Parameter("E45", air.getHearthOverOutAirCoefficient()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E59", result));
        return result;
    }

    /*公式22*/
    @Override
    public Double calculateE64(int caseId, int powerId) {
        Element element = elementDao.getElementByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式22");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;

        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("ME26", element.getCar()));
        params.add(new Parameter("ME30", element.getSar()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E64", result));
        return result;
    }

    /*公式23*/
    @Override
    public Double calculateE65(int caseId, int powerId) {
        Element element = elementDao.getElementByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式23");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e55 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E55"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E55", e55));
        params.add(new Parameter("ME29", element.getNar()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E65", result));
        return result;
    }

    /*公式24*/
    @Override
    public Double calculateE66(int caseId, int powerId) {
        Element element = elementDao.getElementByPowerCaseId(caseId);
        Nature nature = natureDao.getNatureByPowerId(powerId);
        Industry industry = industryDao.getIndustryByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式24");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e55 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E55"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E55", e55));
        params.add(new Parameter("ME27", element.getHar()));
        params.add(new Parameter("ZE14", nature.getAnnualAverageAirMoisture()));
        params.add(new Parameter("ME3", industry.getMar()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E66", result));
        return result;
    }

    /*公式25*/
    @Override
    public Double calculateE67(int caseId, int powerId) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式25");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e64 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E64"));
        double e65 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E65"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E64", e64));
        params.add(new Parameter("E65", e65));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E67", result));
        return result;
    }

    /*公式26*/
    @Override
    public Double calculateE68(int caseId, int powerId) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式26");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e66 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E66"));
        double e67 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E67"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E66", e66));
        params.add(new Parameter("E67", e67));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E68", result));
        return result;
    }

    @Override
    public Double calculateE69(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式27");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e65 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E65"));
        double e55 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E55"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E45", air.getHearthOverOutAirCoefficient()));
        params.add(new Parameter("E65", e65));
        params.add(new Parameter("E55", e55));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E69", result));
        return result;
    }

    @Override
    public Double calculateE70(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式28");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e55 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E55"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E45", air.getHearthOverOutAirCoefficient()));
        params.add(new Parameter("E55", e55));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E70", result));
        return result;
    }

    @Override
    public Double calculateE71(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Nature nature = natureDao.getNatureByPowerId(powerId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式29");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e55 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E55"));
        double e66 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E66"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E45", air.getHearthOverOutAirCoefficient()));
        params.add(new Parameter("E55", e55));
        params.add(new Parameter("E66", e66));
        params.add(new Parameter("ZE14", nature.getAnnualAverageAirMoisture()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E71", result));
        return result;
    }

    @Override
    public Double calculateE72(int caseId, int powerId) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式30");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e64 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E64"));
        double e69 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E69"));
        double e70 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E70"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E64", e64));
        params.add(new Parameter("E69", e69));
        params.add(new Parameter("E70", e70));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E72", result));
        return result;
    }

    @Override
    public Double calculateE73(int caseId, int powerId) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式31");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e72 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E72"));
        double e71 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E71"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E71", e71));
        params.add(new Parameter("E72", e72));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E73", result));
        return result;
    }

    /*锅炉公式32*/
    @Override
    public Double calculateE74(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Industry industry = industryDao.getIndustryByPowerCaseId(caseId);
        Element element = elementDao.getElementByPowerCaseId(caseId);
        Nature nature = natureDao.getNatureByPowerId(powerId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式32");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e55 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E55"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E55", e55));
        params.add(new Parameter("E45", air.getHearthOverOutAirCoefficient()));
        params.add(new Parameter("ZE14", nature.getAnnualAverageAirMoisture()));
        params.add(new Parameter("ME27", element.getHar()));
        params.add(new Parameter("ME29", element.getNar()));
        params.add(new Parameter("ME30", element.getSar()));
        params.add(new Parameter("ME28", element.getOar()));
        params.add(new Parameter("ME3", industry.getMar()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E74", result));
        return result;
    }

    /*锅炉公式33*/
    @Override
    public Double calculateE75(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式33");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e74 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E74"));
        double e58 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E58"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E74", e74));
        params.add(new Parameter("E58", e58));
        params.add(new Parameter("E46", air.getAirPreheaterAirLeakageCoefficient()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E75", result));
        return result;
    }

    /*锅炉公式32*/
    @Override
    public Double calculateE76(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Industry industry = industryDao.getIndustryByPowerCaseId(caseId);
        Nature nature = natureDao.getNatureByPowerId(powerId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式32-1");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Double result1 = null;
        Double result2 = null;
        Expression expression = null;
        double e55 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E55"));
        double e74 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E74"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E46", air.getAirPreheaterAirLeakageCoefficient()));
        params.add(new Parameter("ZE14", nature.getAnnualAverageAirMoisture()));
        params.add(new Parameter("E74", e74));
        params.add(new Parameter("E55", e55));
        params.add(new Parameter("ME6", industry.getAar()));
        Parameters parameters = ParametersUtil.getParameters(params);
        try {
            result1 = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        Formula formula1 = expressionDao.getFormulaByName("锅炉公式32-2");
        String exp1 = formula1.getParamer() + formula1.getFormulaDescription();
        Expression expression1 = null;

        double e58 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E58"));
        try {
            expression1 = ExpressionFactory.createExpression(exp1);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params1 = new HashSet<>();
        params1.add(new Parameter("E46", air.getAirPreheaterAirLeakageCoefficient()));
        params1.add(new Parameter("E45", air.getHearthOverOutAirCoefficient()));
        params1.add(new Parameter("E74", e74));
        params1.add(new Parameter("E58", e58));
        Parameters parameters1 = ParametersUtil.getParameters(params1);
        try {
            result2 = expression1.evaluate(parameters1).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        Double result = null;
        result = Math.max(result1, result2);
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E76", result));
        return result;
    }

    /*锅炉公式35*/
    @Override
    public Double calculateE77(int caseId, int powerId) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式35");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e55 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E55"));
        double e65 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E65"));
        double e76 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E76"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E55", e55));
        params.add(new Parameter("E65", e65));
        params.add(new Parameter("E76", e76));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E77", result));
        return result;
    }

    /*锅炉公式36*/
    @Override
    public Double calculateE78(int caseId, int powerId) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式36");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e55 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E55"));
        double e76 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E76"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E55", e55));
        params.add(new Parameter("E76", e76));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E78", result));
        return result;
    }

    /*锅炉公式37*/
    @Override
    public Double calculateE79(int caseId, int powerId) {
        Nature nature = natureDao.getNatureByPowerId(powerId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式37");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e55 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E55"));
        double e66 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E66"));
        double e76 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E76"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E55", e55));
        params.add(new Parameter("E66", e66));
        params.add(new Parameter("E76", e76));
        params.add(new Parameter("ZE14", nature.getAnnualAverageAirMoisture()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E79", result));
        return result;
    }

    /*锅炉公式38*/
    @Override
    public Double calculateE80(int caseId, int powerId) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式38");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e78 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E78"));
        double e64 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E64"));
        double e77 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E77"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E78", e78));
        params.add(new Parameter("E64", e64));
        params.add(new Parameter("E77", e77));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E80", result));
        return result;
    }

    /*锅炉公式18*/
    @Override
    public Double calculateE60(int caseId, int powerId) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式18");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e58 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E58"));
        double e76 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E76"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E58", e58));
        params.add(new Parameter("E76", e76));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E60", result));
        return result;
    }

    /*锅炉公式20*/
    @Override
    public Double calculateE62(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式20");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e61 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E61"));
        double e60 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E60"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E61", e61));
        params.add(new Parameter("E60", e60));
        params.add(new Parameter("E31", air.getInOnceWindTemperature()));
        params.add(new Parameter("E32", air.getInTwiceWindTemperature()));
        params.add(new Parameter("E42", air.getOnceWindRate()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E62", result));
        return result;
    }

    /*锅炉公式39*/
    @Override
    public Double calculateE81(int caseId, int powerId) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式39");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e80 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E80"));
        double e79 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E79"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E80", e80));
        params.add(new Parameter("E79", e79));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E81", result));
        return result;
    }

    /*锅炉公式40*/
    @Override
    public Double calculateE82(int caseId, int powerId) {
        Nature nature = natureDao.getNatureByPowerId(powerId);
        Industry industry = industryDao.getIndustryByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式40");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e55 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E55"));
        double e76 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E76"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E55", e55));
        params.add(new Parameter("E76", e76));
        params.add(new Parameter("ZE14", nature.getAnnualAverageAirMoisture()));
        params.add(new Parameter("ME6", industry.getAar()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E82", result));
        return result;
    }

    @Override
    public Double calculateE83(int caseId, int powerId) {
        AirGasParameter airGasParameter = airGasParameterDao.getAirGasParameter(caseId);
        double E50 = airGasParameter.getOutAirTemperature();
        Formula formula = expressionDao.getFormulaByName("锅炉公式41");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E50", E50));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E83", result));
        return result;
    }

    @Override
    public Double calculateE84(int caseId, int powerId) {
        AirGasParameter airGasParameter = airGasParameterDao.getAirGasParameter(caseId);
        double E50 = airGasParameter.getOutAirTemperature();
        Formula formula = expressionDao.getFormulaByName("锅炉公式42");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E50", E50));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E84", result));
        return result;
    }

    @Override
    public Double calculateE85(int caseId, int powerId) {
        AirGasParameter airGasParameter = airGasParameterDao.getAirGasParameter(caseId);
        double E50 = airGasParameter.getOutAirTemperature();
        Formula formula = expressionDao.getFormulaByName("锅炉公式43");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E50", E50));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E85", result));
        return result;
    }

    @Override
    public Double calculateE86(int caseId, int powerId) {
        AirGasParameter airGasParameter = airGasParameterDao.getAirGasParameter(caseId);
        double E50 = airGasParameter.getOutAirTemperature();
        Formula formula = expressionDao.getFormulaByName("锅炉公式44");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E50", E50));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E86", result));
        return result;
    }

    @Override
    public Double calculateE87(int caseId, int powerId) {
        AirGasParameter airGasParameter = airGasParameterDao.getAirGasParameter(caseId);
        double E50 = airGasParameter.getOutAirTemperature();
        Formula formula = expressionDao.getFormulaByName("锅炉公式45");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double E83 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E83"));
        double E64 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E64"));
        double E84 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E84"));
        double E77 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E77"));
        double E85 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E85"));
        double E78 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E78"));
        double E86 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E86"));
        double E79 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E79"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E50", E50));
        params.add(new Parameter("E83", E83));
        params.add(new Parameter("E64", E64));
        params.add(new Parameter("E84", E84));
        params.add(new Parameter("E77", E77));
        params.add(new Parameter("E85", E85));
        params.add(new Parameter("E78", E78));
        params.add(new Parameter("E86", E86));
        params.add(new Parameter("E79", E79));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E87", result));
        return result;
    }

    @Override
    public Double calculateE91(int caseId, int powerId) {
        SodaParameter sodaParameter = sodaParameterDao.getSodaParameter(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式49");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double E3 = sodaParameter.getDgr();
        double E6 = sodaParameter.getIgr();
        double E9 = sodaParameter.getIgs();
        double E13 = sodaParameter.getDzr();
        double E24 = sodaParameter.getDdesR();
        double E16 = sodaParameter.getIzr();
        double E19 = sodaParameter.getIzr3();
        double E30 = sodaParameter.getDbw();
        double E12 = sodaParameter.getIqb();
        double E23 = sodaParameter.getHdesS();
        double E27 = sodaParameter.getHdesR();
        double E20 = sodaParameter.getDdesS();
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E3", E3));
        params.add(new Parameter("E6", E6));
        params.add(new Parameter("E9", E9));
        params.add(new Parameter("E13", E13));
        params.add(new Parameter("E24", E24));
        params.add(new Parameter("E16", E16));
        params.add(new Parameter("E19", E19));
        params.add(new Parameter("E30", E30));
        params.add(new Parameter("E12", E12));
        params.add(new Parameter("E23", E23));
        params.add(new Parameter("E27", E27));
        params.add(new Parameter("E20", E20));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E91", result));
        return result;
    }

    /*锅炉公式54*/
    @Override
    public Double calculateE96(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Efficiency efficiency = efficiencyDao.getEfficiencyByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式54");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e59 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E59"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E59", e59));
        params.add(new Parameter("E95", efficiency.getE95()));
        params.add(new Parameter("E43", air.getHearthAirLeakageRate()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E96", result));
        return result;
    }

    /*锅炉公式55*/
    @Override
    public Double calculateE97(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式55");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e96 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E96"));
        double e41 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E41"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E96", e96));
        params.add(new Parameter("E42", air.getOnceWindRate()));
        params.add(new Parameter("E41", e41));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E97", result));
        return result;
    }

    /*锅炉公式56*/
    @Override
    public Double calculateE98(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Nature nature = natureDao.getNatureByPowerId(powerId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式56");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e97 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E97"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E97", e97));
        params.add(new Parameter("E33", air.getOutOnceWindTemperature()));
        params.add(new Parameter("ZE15", nature.getLocalDensityMoistAir()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E98", result));
        return result;
    }

    /*锅炉公式57*/
    @Override
    public Double calculateE99(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式57");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e96 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E96"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E96", e96));
        params.add(new Parameter("E42", air.getOnceWindRate()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E99", result));
        return result;
    }

    /*锅炉公式58*/
    @Override
    public Double calculateE100(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Nature nature = natureDao.getNatureByPowerId(powerId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式58");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e99 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E99"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E99", e99));
        params.add(new Parameter("ZE15", nature.getLocalDensityMoistAir()));
        params.add(new Parameter("E34", air.getOutTwiceWindTemperature()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E100", result));
        return result;
    }

    /*锅炉公式59*/
    @Override
    public Double calculateE101(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式59");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e97 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E97"));
        double e41 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E41"));
        double e96 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E96"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E97", e97));
        params.add(new Parameter("E41", e41));
        params.add(new Parameter("E96", e96));
        params.add(new Parameter("E42", air.getOnceWindRate()));
        params.add(new Parameter("E44", air.getSystemAirLeakageCoefficient()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E101", result));
        return result;
    }

    /*锅炉公式60*/
    @Override
    public Double calculateE102(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Nature nature = natureDao.getNatureByPowerId(powerId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式60");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e101 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E101"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E101", e101));
        params.add(new Parameter("ZE15", nature.getLocalDensityMoistAir()));
        params.add(new Parameter("E31", air.getInOnceWindTemperature()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E102", result));
        return result;
    }

    /*锅炉公式61*/
    @Override
    public Double calculateE103(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Efficiency efficiency = efficiencyDao.getEfficiencyByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式61");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e97 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E97"));
        double e38 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E38"));
        double e36 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E36"));
        double e99 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E99"));
        double e39 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E39"));
        double e37 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E37"));
        double e83 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E83"));
        double e64 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E64"));
        double e84 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E84"));
        double e77 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E77"));
        double e85 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E85"));
        double e78 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E78"));
        double e86 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E86"));
        double e79 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E79"));

        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E97", e97));
        params.add(new Parameter("E95", efficiency.getE95()));
        params.add(new Parameter("E33", air.getOutOnceWindTemperature()));
        params.add(new Parameter("E38", e38));
        params.add(new Parameter("E31", air.getInOnceWindTemperature()));
        params.add(new Parameter("E36", e36));
        params.add(new Parameter("E99", e99));
        params.add(new Parameter("E39", e39));
        params.add(new Parameter("E34", air.getOutTwiceWindTemperature()));
        params.add(new Parameter("E37", e37));
        params.add(new Parameter("E32", air.getInTwiceWindTemperature()));
        params.add(new Parameter("E83", e83));
        params.add(new Parameter("E64", e64));
        params.add(new Parameter("E84", e84));
        params.add(new Parameter("E77", e77));
        params.add(new Parameter("E85", e85));
        params.add(new Parameter("E78", e78));
        params.add(new Parameter("E86", e86));
        params.add(new Parameter("E79", e79));
        params.add(new Parameter("E50", air.getOutAirTemperature()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E103", result));
        return result;
    }

    /*锅炉公式62*/
    @Override
    public Double calculateE104(int caseId, int powerId) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式62");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e103 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E103"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E103", e103));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E104", result));
        return result;
    }

    /*锅炉公式63*/
    @Override
    public Double calculateE105(int caseId, int powerId) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式63");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e103 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E103"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E103", e103));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E105", result));
        return result;
    }

    /*锅炉公式64*/
    @Override
    public Double calculateE106(int caseId, int powerId) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式64");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e103 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E103"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E103", e103));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E106", result));
        return result;
    }

    /*锅炉公式65*/
    @Override
    public Double calculateE107(int caseId, int powerId) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式65");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e103 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E103"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E103", e103));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E107", result));
        return result;
    }

    /*锅炉公式66*/
    @Override
    public Double calculateE108(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Efficiency efficiency = efficiencyDao.getEfficiencyByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式66");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e97 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E97"));
        double e38 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E38"));
        double e36 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E36"));
        double e99 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E99"));
        double e39 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E39"));
        double e37 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E37"));
        double e87 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E87"));
        double e104 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E104"));
        double e105 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E105"));
        double e106 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E106"));
        double e107 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E107"));
        double e64 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E64"));
        double e69 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E69"));
        double e70 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E70"));
        double e71 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E71"));

        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E97", e97));
        params.add(new Parameter("E95", efficiency.getE95()));
        params.add(new Parameter("E33", air.getOutOnceWindTemperature()));
        params.add(new Parameter("E38", e38));
        params.add(new Parameter("E31", air.getInOnceWindTemperature()));
        params.add(new Parameter("E36", e36));
        params.add(new Parameter("E99", e99));
        params.add(new Parameter("E39", e39));
        params.add(new Parameter("E34", air.getOutTwiceWindTemperature()));
        params.add(new Parameter("E37", e37));
        params.add(new Parameter("E32", air.getInTwiceWindTemperature()));
        params.add(new Parameter("E87", e87));
        params.add(new Parameter("E104", e104));
        params.add(new Parameter("E105", e105));
        params.add(new Parameter("E106", e106));
        params.add(new Parameter("E107", e107));
        params.add(new Parameter("E64", e64));
        params.add(new Parameter("E69", e69));
        params.add(new Parameter("E70", e70));
        params.add(new Parameter("E71", e71));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E108", result));
        return result;
    }

    /*锅炉公式67*/
    @Override
    public Double calculateE109(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Efficiency efficiency = efficiencyDao.getEfficiencyByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式67");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e73 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E73"));
        double e108 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E108"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E73", e73));
        params.add(new Parameter("E108", e108));
        params.add(new Parameter("E94", efficiency.getE94()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E109", result));
        return result;
    }

    /*锅炉公式68*/
    @Override
    public Double calculateE110(int caseId, int powerId) {
        Efficiency efficiency = efficiencyDao.getEfficiencyByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式68");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e74 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E74"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E74", e74));
        params.add(new Parameter("E94", efficiency.getE94()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E110", result));
        return result;
    }

    /*锅炉公式69*/
    @Override
    public Double calculateE112(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        double e111 = air.getWarehouse();
        double e46 = air.getAirPreheaterAirLeakageCoefficient();
        double e97 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E97"));
        double e110 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E110"));
        Double result = null;
        result = (e111 == 1) ? (e46 * (1 - 0.001 / e46)) / (e97 / e110 + (e46 * (1 - 0.001 / e46))) : (e46 * (1 + 0.006 / e46)) / (e97 / e110 + (e46 * (1 + 0.006 / e46)));
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E112", result));
        return result;
    }

    /*锅炉公式70*/
    @Override
    public Double calculateE113(int caseId, int powerId) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式70");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e97 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E97"));
        double e112 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E112"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E97", e97));
        params.add(new Parameter("E112", e112));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E113", result));
        return result;
    }

    /*锅炉公式71*/
    @Override
    public Double calculateE114(int caseId, int powerId) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式71");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e97 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E97"));
        double e113 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E113"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E97", e97));
        params.add(new Parameter("E113", e113));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E114", result));
        return result;
    }

    /*锅炉公式71*/
    @Override
    public Double calculateE115(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Nature nature = natureDao.getNatureByPowerId(powerId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式72");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e114 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E114"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E114", e114));
        params.add(new Parameter("E31", air.getInOnceWindTemperature()));
        params.add(new Parameter("ZE15", nature.getLocalDensityMoistAir()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E115", result));
        return result;
    }

    /*锅炉公式73*/
    @Override
    public Double calculateE116(int caseId, int powerId) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式73");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e114 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E114"));
        double e101 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E101"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E114", e114));
        params.add(new Parameter("E101", e101));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E116", result));
        return result;
    }

    /*锅炉公式74*/
    @Override
    public Double calculateE117(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Nature nature = natureDao.getNatureByPowerId(powerId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式74");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e116 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E116"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E116", e116));
        params.add(new Parameter("ZE15", nature.getLocalDensityMoistAir()));
        params.add(new Parameter("E31", air.getInOnceWindTemperature()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E117", result));
        return result;
    }

    /*锅炉公式75*/
    @Override
    public Double calculateE118(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式75");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e110 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E110"));
        double e113 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E113"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E110", e110));
        params.add(new Parameter("E113", e113));
        params.add(new Parameter("E46", air.getAirPreheaterAirLeakageCoefficient()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E118", result));
        return result;
    }

    /*锅炉公式76*/
    @Override
    public Double calculateE119(int caseId, int powerId) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式76");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e118 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E118"));
        double e99 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E99"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E118", e118));
        params.add(new Parameter("E99", e99));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E119", result));
        return result;
    }

    /*锅炉公式77*/
    @Override
    public Double calculateE120(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Nature nature = natureDao.getNatureByPowerId(powerId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式77");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e119 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E119"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E119", e119));
        params.add(new Parameter("E32", air.getInTwiceWindTemperature()));
        params.add(new Parameter("ZE15", nature.getLocalDensityMoistAir()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E120", result));
        return result;
    }

    /*锅炉公式78*/
    @Override
    public Double calculateE121(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式78");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e64 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E64"));
        double e83 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E83"));
        double e69 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E69"));
        double e84 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E84"));
        double e70 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E70"));
        double e85 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E85"));
        double e71 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E71"));
        double e86 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E86"));
        double e74 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E74"));
        double e61 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E61"));
        double e77 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E77"));
        double e78 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E78"));
        double e79 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E79"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E50", air.getOutAirTemperature()));
        params.add(new Parameter("E64", e64));
        params.add(new Parameter("E83", e83));
        params.add(new Parameter("E69", e69));
        params.add(new Parameter("E84", e84));
        params.add(new Parameter("E70", e70));
        params.add(new Parameter("E85", e85));
        params.add(new Parameter("E71", e71));
        params.add(new Parameter("E86", e86));
        params.add(new Parameter("E46", air.getAirPreheaterAirLeakageCoefficient()));
        params.add(new Parameter("E74", e74));
        params.add(new Parameter("E61", e61));
        params.add(new Parameter("E77", e77));
        params.add(new Parameter("E78", e78));
        params.add(new Parameter("E79", e79));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E121", result));
        return result;
    }

    /*锅炉公式79*/
    @Override
    public Double calculateE122(int caseId, int powerId) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式79");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e121 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E121"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E121", e121));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E122", result));
        return result;
    }

    /*锅炉公式80*/
    @Override
    public Double calculateE123(int caseId, int powerId) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式80");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e121 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E121"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E121", e121));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E123", result));
        return result;
    }

    /*锅炉公式81*/
    @Override
    public Double calculateE124(int caseId, int powerId) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式81");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e121 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E121"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E121", e121));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E124", result));
        return result;
    }

    /*锅炉公式82*/
    @Override
    public Double calculateE125(int caseId, int powerId) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式82");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e121 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E121"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E121", e121));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E125", result));
        return result;
    }

    /*锅炉公式83*/
    @Override
    public Double calculateE126(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式83");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e64 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E64"));
        double e83 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E83"));
        double e69 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E69"));
        double e84 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E84"));
        double e70 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E70"));
        double e85 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E85"));
        double e71 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E71"));
        double e86 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E86"));
        double e74 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E74"));
        double e61 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E61"));
        double e77 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E77"));
        double e78 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E78"));
        double e79 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E79"));
        double e122 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E122"));
        double e123 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E123"));
        double e124 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E124"));
        double e125 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E125"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E50", air.getOutAirTemperature()));
        params.add(new Parameter("E64", e64));
        params.add(new Parameter("E83", e83));
        params.add(new Parameter("E69", e69));
        params.add(new Parameter("E84", e84));
        params.add(new Parameter("E70", e70));
        params.add(new Parameter("E85", e85));
        params.add(new Parameter("E71", e71));
        params.add(new Parameter("E86", e86));
        params.add(new Parameter("E46", air.getAirPreheaterAirLeakageCoefficient()));
        params.add(new Parameter("E74", e74));
        params.add(new Parameter("E61", e61));
        params.add(new Parameter("E77", e77));
        params.add(new Parameter("E78", e78));
        params.add(new Parameter("E79", e79));
        params.add(new Parameter("E123", e123));
        params.add(new Parameter("E122", e122));
        params.add(new Parameter("E124", e124));
        params.add(new Parameter("E125", e125));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E126", result));
        return result;
    }

    /*锅炉公式84*/
    @Override
    public Double calculateE127(int caseId, int powerId) {
        Efficiency efficiency = efficiencyDao.getEfficiencyByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式84");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e82 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E82"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E82", e82));
        params.add(new Parameter("E95", efficiency.getE95()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E127", result));
        return result;
    }

    /*锅炉公式85*/
    @Override
    public Double calculateE128(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Efficiency efficiency = efficiencyDao.getEfficiencyByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式85");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e81 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E81"));
        double e126 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E126"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E94", efficiency.getE94()));
        params.add(new Parameter("E81", e81));
        params.add(new Parameter("E126", e126));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E128", result));
        return result;
    }

    /*锅炉公式86*/
    @Override
    public Double calculateE129(int caseId, int powerId) {
        AirGasParameter air = airGasParameterDao.getAirGasParameter(caseId);
        Industry industry = industryDao.getIndustryByPowerCaseId(caseId);
        Formula formula = expressionDao.getFormulaByName("锅炉公式86");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e73 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E73"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E28", air.getE28()));
        params.add(new Parameter("E73", e73));
        params.add(new Parameter("ME6", industry.getAar()));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E129", result));
        return result;
    }

    /*锅炉公式87*/
    @Override
    public Double calculateE130(int caseId, int powerId) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式87");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e118 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E118"));
        double e119 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E119"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E118", e118));
        params.add(new Parameter("E119", e119));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E130", result));
        return result;
    }

    /*锅炉公式88*/
    @Override
    public Double calculateE131(int caseId, int powerId) {
        Formula formula = expressionDao.getFormulaByName("锅炉公式88");
        String exp = formula.getParamer() + formula.getFormulaDescription();
        Expression expression = null;
        double e41 = middleResultDao.getMiddleResult(new MiddleResult(caseId, "E41"));
        try {
            expression = ExpressionFactory.createExpression(exp);
        } catch (ParsingException e) {
            e.printStackTrace();
        }
        Set<Parameter> params = new HashSet<>();
        params.add(new Parameter("E41", e41));
        Parameters parameters = ParametersUtil.getParameters(params);
        Double result = null;
        try {
            result = expression.evaluate(parameters).getRealValue();
        } catch (EvalException e) {
            e.printStackTrace();
        }
        middleResultDao.upMiddleResult(new MiddleResult(caseId, "E131", result));
        return result;
    }

    @Override
    public MiddleResult getMiddle(MiddleResult m) {
        MiddleResult middleResult = middleResultDao.getMiddle(m);
        if (middleResult == null) {
            return new MiddleResult();
        }
        return middleResult;
    }


}
